/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * OptionsForm.java
 *
 * Created on 14.10.2009, 10:51:10
 */

package vizzy.forms.panels;

import java.awt.Color;
import java.awt.Cursor;
import java.awt.Desktop;
import java.awt.Rectangle;
import java.io.File;
import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.logging.Level;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JColorChooser;
import javax.swing.JFileChooser;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.apache.log4j.Logger;
import vizzy.controller.VizzyController;
import vizzy.model.Conf;
import vizzy.model.HighlightsColorData;
import vizzy.model.SettingsModel;

/**
 *
 * @author sergeil
 */
public class OptionsForm extends javax.swing.JFrame {

    private static final Logger log = Logger.getLogger(OptionsForm.class);

    private VizzyController controller;
    private SettingsModel settings;
    private int menuIndex = -1;

    /** Creates new form OptionsForm */
    public OptionsForm(Rectangle rect, VizzyController controller, SettingsModel settings) {
        this.controller = controller;
        this.settings = settings;
        initComponents();
        afterInitComponents();
        initPositionAndSize(rect);
    }

    private void checkFlashDevelop() {
        boolean b = false;
        String text = jCustomASEditorTextFiled.getText();
        if (Conf.OSName.indexOf(Conf.OS_WINDOWS) > -1) {
            if (text != null
                    && text.indexOf("FlashDevelop") > -1) {
                b = true;
            }
        }
        jFlashDevelopIntegrLabel.setVisible(b);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        ASEditorButtonGroup = new javax.swing.ButtonGroup();
        jPanelTraceOutput = new javax.swing.JPanel();
        jCheckBoxBuffer = new javax.swing.JCheckBox();
        jCheckBoxTraceAll = new javax.swing.JCheckBox();
        jLabel7 = new javax.swing.JLabel();
        jCheckBoxVerbose = new javax.swing.JCheckBox();
        jCheckBoxStatic = new javax.swing.JCheckBox();
        jPanelTraceParser = new javax.swing.JPanel();
        jEnableClickCheckBox = new javax.swing.JCheckBox();
        jLabelClickInfo = new javax.swing.JLabel();
        jEnablePopupsCheckBox = new javax.swing.JCheckBox();
        jLabelCodePopupInfo = new javax.swing.JLabel();
        jEnableVizzyTraceCheckBox = new javax.swing.JCheckBox();
        jLabelVizzyTraceInfo = new javax.swing.JLabel();
        jLayeredPane1 = new javax.swing.JLayeredPane();
        jHighlight1TextField = new javax.swing.JTextField();
        jHighlight1Panel = new javax.swing.JPanel();
        jHighlight2TextField = new javax.swing.JTextField();
        jHighlight2Panel = new javax.swing.JPanel();
        jHighlight3TextField = new javax.swing.JTextField();
        jHighlight3Panel = new javax.swing.JPanel();
        jHighlight4TextField = new javax.swing.JTextField();
        jHighlight4Panel = new javax.swing.JPanel();
        jHighlight5TextField = new javax.swing.JTextField();
        jHighlight5Panel = new javax.swing.JPanel();
        jHighlight6TextField = new javax.swing.JTextField();
        jHighlight6Panel = new javax.swing.JPanel();
        jHighlight7TextField = new javax.swing.JTextField();
        jHighlight7Panel = new javax.swing.JPanel();
        jHighlight8TextField = new javax.swing.JTextField();
        jHighlight8Panel = new javax.swing.JPanel();
        jHighlight9TextField = new javax.swing.JTextField();
        jHighlight9Panel = new javax.swing.JPanel();
        jPanelGeneral = new javax.swing.JPanel();
        jLayeredPane2 = new javax.swing.JLayeredPane();
        jLabel3 = new javax.swing.JLabel();
        jFontSizeTextField = new javax.swing.JTextField();
        jFontComboBox = new javax.swing.JComboBox();
        jLabel5 = new javax.swing.JLabel();
        jRestoreCheckBox = new javax.swing.JCheckBox();
        jLayeredPane5 = new javax.swing.JLayeredPane();
        bgColorLabel = new javax.swing.JLabel();
        fontColorLabel = new javax.swing.JLabel();
        bgColorPanel = new javax.swing.JPanel();
        fontColorPanel = new javax.swing.JPanel();
        jPanelLogFile = new javax.swing.JPanel();
        jLayeredPane3 = new javax.swing.JLayeredPane();
        jUTFCheckBox = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        jFlashLogTextField = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        jFreqTextField = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLayeredPane4 = new javax.swing.JLayeredPane();
        jNumLinesTextField = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jNumLinesEnabledCheckBox = new javax.swing.JCheckBox();
        jPanelApplications = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jDefaultRadioButton = new javax.swing.JRadioButton();
        jCustomEditorRadioButton = new javax.swing.JRadioButton();
        jCustomASEditorTextFiled = new javax.swing.JTextField();
        jFlashDevelopIntegrLabel = new javax.swing.JLabel();
        jFlashDevelopIntegrLabel1 = new javax.swing.JLabel();
        jPanelUpdates = new javax.swing.JPanel();
        jVersionLabel = new javax.swing.JLabel();
        jUpdatesCheckBox = new javax.swing.JCheckBox();
        jOKButton = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jListMenu = new javax.swing.JList();
        jPanelContainer = new javax.swing.JPanel();

        jCheckBoxBuffer.setText("<html>Buffer trace output. Use this if you trace really much which causes your CPU work with 100% load</html>");

        jCheckBoxTraceAll.setText("<html>Trace all executed methods. Warning: use with \"Buffer Trace Output\" only! (AS3 only)</html>");
        jCheckBoxTraceAll.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxTraceAllActionPerformed(evt);
            }
        });

        jLabel7.setText("<html>You will need to restart your browser after changing these settings</html>");
        jLabel7.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        jCheckBoxVerbose.setText("<html>Trace bytecode. Traces detailed information about SWF bytecode and runtime parsing. (AS3 only)</html>");
        jCheckBoxVerbose.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxVerboseActionPerformed(evt);
            }
        });

        jCheckBoxStatic.setText("<html>Outputs information about functions, bytecode, memory used, etc. (AS3 only)</html>");
        jCheckBoxStatic.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jCheckBoxStaticActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanelTraceOutputLayout = new org.jdesktop.layout.GroupLayout(jPanelTraceOutput);
        jPanelTraceOutput.setLayout(jPanelTraceOutputLayout);
        jPanelTraceOutputLayout.setHorizontalGroup(
            jPanelTraceOutputLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelTraceOutputLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelTraceOutputLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jCheckBoxStatic, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 270, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jCheckBoxVerbose, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 304, Short.MAX_VALUE)
                    .add(jCheckBoxTraceAll, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 0, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jCheckBoxBuffer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 291, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 304, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );

        jPanelTraceOutputLayout.linkSize(new java.awt.Component[] {jCheckBoxBuffer, jCheckBoxStatic, jCheckBoxTraceAll, jCheckBoxVerbose, jLabel7}, org.jdesktop.layout.GroupLayout.HORIZONTAL);

        jPanelTraceOutputLayout.setVerticalGroup(
            jPanelTraceOutputLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelTraceOutputLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel7, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 30, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jCheckBoxBuffer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jCheckBoxTraceAll, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 41, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jCheckBoxVerbose, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 43, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jCheckBoxStatic, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 46, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(94, Short.MAX_VALUE))
        );

        jPanelTraceOutputLayout.linkSize(new java.awt.Component[] {jCheckBoxBuffer, jCheckBoxStatic, jCheckBoxTraceAll, jCheckBoxVerbose}, org.jdesktop.layout.GroupLayout.VERTICAL);

        jEnableClickCheckBox.setText("<html>1. Open HTTP links on double click.<br>2. Open source files from stack traces on double click.</html>");
        jEnableClickCheckBox.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);

        jLabelClickInfo.setText("<html>(<a href=\"http://code.google.com/p/flash-tracer/wiki/Features#HTTP_Links_are_Clickable_(since_2.3)\">what's this?</a>)</html>");
        jLabelClickInfo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelClickInfoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jFlashDevelopIntegrLabelMouseEntered(evt);
            }
        });

        jEnablePopupsCheckBox.setText("<html>Enable code popup on right click to explore stack-traces and JSON</html>");
        jEnablePopupsCheckBox.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);

        jLabelCodePopupInfo.setText("<html>(<a href=\"http://code.google.com/p/flash-tracer/wiki/Features#Explore_Source_Code_(since_2.3)\">what's this?</a>)</html>");
        jLabelCodePopupInfo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelCodePopupInfoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jFlashDevelopIntegrLabelMouseEntered(evt);
            }
        });

        jEnableVizzyTraceCheckBox.setText("<html>Connect VizzyTrace library</html>");
        jEnableVizzyTraceCheckBox.setToolTipText("Parses VizzyTrace library debug information. See more information in product wiki page.");
        jEnableVizzyTraceCheckBox.setVerticalAlignment(javax.swing.SwingConstants.BOTTOM);

        jLabelVizzyTraceInfo.setText("<html>(<a href=\"http://code.google.com/p/flash-tracer/wiki/VizzyTrace\">what's this?</a>)</html>");
        jLabelVizzyTraceInfo.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabelVizzyTraceInfoMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jFlashDevelopIntegrLabelMouseEntered(evt);
            }
        });

        jLayeredPane1.setBorder(javax.swing.BorderFactory.createTitledBorder("Highlight lines starting with..."));
        jHighlight1TextField.setBounds(10, 20, 90, 20);
        jLayeredPane1.add(jHighlight1TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight1Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight1Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight1PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight1PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight1Panel);
        jHighlight1Panel.setLayout(jHighlight1PanelLayout);
        jHighlight1PanelLayout.setHorizontalGroup(
            jHighlight1PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight1PanelLayout.setVerticalGroup(
            jHighlight1PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight1Panel.setBounds(100, 20, 20, 20);
        jLayeredPane1.add(jHighlight1Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight2TextField.setBounds(10, 45, 90, 20);
        jLayeredPane1.add(jHighlight2TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight2Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight2Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight2PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight2PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight2Panel);
        jHighlight2Panel.setLayout(jHighlight2PanelLayout);
        jHighlight2PanelLayout.setHorizontalGroup(
            jHighlight2PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight2PanelLayout.setVerticalGroup(
            jHighlight2PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight2Panel.setBounds(100, 45, 20, 20);
        jLayeredPane1.add(jHighlight2Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight3TextField.setBounds(10, 70, 90, 20);
        jLayeredPane1.add(jHighlight3TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight3Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight3Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight3PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight3PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight3Panel);
        jHighlight3Panel.setLayout(jHighlight3PanelLayout);
        jHighlight3PanelLayout.setHorizontalGroup(
            jHighlight3PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight3PanelLayout.setVerticalGroup(
            jHighlight3PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight3Panel.setBounds(100, 70, 20, 20);
        jLayeredPane1.add(jHighlight3Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight4TextField.setBounds(140, 20, 80, 20);
        jLayeredPane1.add(jHighlight4TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight4Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight4Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight4PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight4PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight4Panel);
        jHighlight4Panel.setLayout(jHighlight4PanelLayout);
        jHighlight4PanelLayout.setHorizontalGroup(
            jHighlight4PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight4PanelLayout.setVerticalGroup(
            jHighlight4PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight4Panel.setBounds(220, 20, 20, 20);
        jLayeredPane1.add(jHighlight4Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight5TextField.setBounds(140, 45, 80, 20);
        jLayeredPane1.add(jHighlight5TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight5Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight5Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight5PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight5PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight5Panel);
        jHighlight5Panel.setLayout(jHighlight5PanelLayout);
        jHighlight5PanelLayout.setHorizontalGroup(
            jHighlight5PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight5PanelLayout.setVerticalGroup(
            jHighlight5PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight5Panel.setBounds(220, 45, 20, 20);
        jLayeredPane1.add(jHighlight5Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight6TextField.setBounds(140, 70, 80, 20);
        jLayeredPane1.add(jHighlight6TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight6Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight6Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight6PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight6PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight6Panel);
        jHighlight6Panel.setLayout(jHighlight6PanelLayout);
        jHighlight6PanelLayout.setHorizontalGroup(
            jHighlight6PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight6PanelLayout.setVerticalGroup(
            jHighlight6PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight6Panel.setBounds(220, 70, 20, 20);
        jLayeredPane1.add(jHighlight6Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight7TextField.setBounds(260, 20, 70, 20);
        jLayeredPane1.add(jHighlight7TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight7Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight7Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight7PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight7PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight7Panel);
        jHighlight7Panel.setLayout(jHighlight7PanelLayout);
        jHighlight7PanelLayout.setHorizontalGroup(
            jHighlight7PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight7PanelLayout.setVerticalGroup(
            jHighlight7PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight7Panel.setBounds(330, 20, 20, 20);
        jLayeredPane1.add(jHighlight7Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight8TextField.setBounds(260, 45, 70, 20);
        jLayeredPane1.add(jHighlight8TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight8Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight8Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight8PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight8PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight8Panel);
        jHighlight8Panel.setLayout(jHighlight8PanelLayout);
        jHighlight8PanelLayout.setHorizontalGroup(
            jHighlight8PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight8PanelLayout.setVerticalGroup(
            jHighlight8PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight8Panel.setBounds(330, 45, 20, 20);
        jLayeredPane1.add(jHighlight8Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jHighlight9TextField.setBounds(260, 70, 70, 20);
        jLayeredPane1.add(jHighlight9TextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jHighlight9Panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        jHighlight9Panel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jHighlight9PanelMouseClicked(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jHighlight9PanelLayout = new org.jdesktop.layout.GroupLayout(jHighlight9Panel);
        jHighlight9Panel.setLayout(jHighlight9PanelLayout);
        jHighlight9PanelLayout.setHorizontalGroup(
            jHighlight9PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );
        jHighlight9PanelLayout.setVerticalGroup(
            jHighlight9PanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 16, Short.MAX_VALUE)
        );

        jHighlight9Panel.setBounds(330, 70, 20, 20);
        jLayeredPane1.add(jHighlight9Panel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        org.jdesktop.layout.GroupLayout jPanelTraceParserLayout = new org.jdesktop.layout.GroupLayout(jPanelTraceParser);
        jPanelTraceParser.setLayout(jPanelTraceParserLayout);
        jPanelTraceParserLayout.setHorizontalGroup(
            jPanelTraceParserLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelTraceParserLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelTraceParserLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLayeredPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 383, Short.MAX_VALUE)
                    .add(jPanelTraceParserLayout.createSequentialGroup()
                        .add(jPanelTraceParserLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jPanelTraceParserLayout.createSequentialGroup()
                                .add(21, 21, 21)
                                .add(jLabelClickInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 210, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(jEnableClickCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 330, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jPanelTraceParserLayout.createSequentialGroup()
                                .add(21, 21, 21)
                                .add(jLabelCodePopupInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 290, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                            .add(jEnablePopupsCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 330, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jPanelTraceParserLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                                .add(jLabelVizzyTraceInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 310, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                .add(jEnableVizzyTraceCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 330, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap(53, Short.MAX_VALUE))))
        );
        jPanelTraceParserLayout.setVerticalGroup(
            jPanelTraceParserLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelTraceParserLayout.createSequentialGroup()
                .addContainerGap()
                .add(jEnableClickCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 50, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabelClickInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(18, 18, 18)
                .add(jEnablePopupsCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabelCodePopupInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(18, 18, 18)
                .add(jEnableVizzyTraceCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLabelVizzyTraceInfo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 16, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLayeredPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 126, Short.MAX_VALUE)
                .addContainerGap())
        );

        jLayeredPane2.setBorder(javax.swing.BorderFactory.createTitledBorder("Font"));

        jLabel3.setText("Font size:");
        jLabel3.setBounds(240, 20, 90, 14);
        jLayeredPane2.add(jLabel3, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jFontSizeTextField.setBounds(240, 40, 90, 23);
        jLayeredPane2.add(jFontSizeTextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jFontComboBox.setModel(new DefaultComboBoxModel(settings.getFontNames()));
        jFontComboBox.setBounds(10, 40, 220, 23);
        jLayeredPane2.add(jFontComboBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel5.setText("Font:");
        jLabel5.setBounds(10, 20, 250, 14);
        jLayeredPane2.add(jLabel5, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jRestoreCheckBox.setText("<html>Restore window on trace update if window minimized</html>");
        jRestoreCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jRestoreCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));

        jLayeredPane5.setBorder(javax.swing.BorderFactory.createTitledBorder("Colors"));

        bgColorLabel.setText("Background color:");
        bgColorLabel.setBounds(180, 20, 150, 15);
        jLayeredPane5.add(bgColorLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        fontColorLabel.setText("Font color: ");
        fontColorLabel.setBounds(10, 20, 130, 15);
        jLayeredPane5.add(fontColorLabel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        bgColorPanel.setBackground(new java.awt.Color(255, 255, 0));
        bgColorPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        bgColorPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                bgColorPanelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                bgColorPanelMouseEntered(evt);
            }
        });

        org.jdesktop.layout.GroupLayout bgColorPanelLayout = new org.jdesktop.layout.GroupLayout(bgColorPanel);
        bgColorPanel.setLayout(bgColorPanelLayout);
        bgColorPanelLayout.setHorizontalGroup(
            bgColorPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 18, Short.MAX_VALUE)
        );
        bgColorPanelLayout.setVerticalGroup(
            bgColorPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 18, Short.MAX_VALUE)
        );

        bgColorPanel.setBounds(180, 40, 20, 20);
        jLayeredPane5.add(bgColorPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        fontColorPanel.setBackground(new java.awt.Color(255, 51, 51));
        fontColorPanel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
        fontColorPanel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                fontColorPanelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                fontColorPanelMouseEntered(evt);
            }
        });

        org.jdesktop.layout.GroupLayout fontColorPanelLayout = new org.jdesktop.layout.GroupLayout(fontColorPanel);
        fontColorPanel.setLayout(fontColorPanelLayout);
        fontColorPanelLayout.setHorizontalGroup(
            fontColorPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 18, Short.MAX_VALUE)
        );
        fontColorPanelLayout.setVerticalGroup(
            fontColorPanelLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(0, 18, Short.MAX_VALUE)
        );

        fontColorPanel.setBounds(10, 40, 20, 20);
        jLayeredPane5.add(fontColorPanel, javax.swing.JLayeredPane.DEFAULT_LAYER);

        org.jdesktop.layout.GroupLayout jPanelGeneralLayout = new org.jdesktop.layout.GroupLayout(jPanelGeneral);
        jPanelGeneral.setLayout(jPanelGeneralLayout);
        jPanelGeneralLayout.setHorizontalGroup(
            jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelGeneralLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLayeredPane5, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
                    .add(jLayeredPane2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jPanelGeneralLayout.createSequentialGroup()
                        .add(jRestoreCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 317, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(45, 45, 45)))
                .addContainerGap())
        );
        jPanelGeneralLayout.setVerticalGroup(
            jPanelGeneralLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelGeneralLayout.createSequentialGroup()
                .addContainerGap()
                .add(jRestoreCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 41, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLayeredPane2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 83, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLayeredPane5, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 76, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(123, Short.MAX_VALUE))
        );

        jLayeredPane3.setBorder(javax.swing.BorderFactory.createTitledBorder("Log file"));

        jUTFCheckBox.setText("read file as UTF-8");
        jUTFCheckBox.setBounds(160, 16, 180, 20);
        jLayeredPane3.add(jUTFCheckBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel4.setText("flash log location:");
        jLabel4.setBounds(10, 20, 180, 14);
        jLayeredPane3.add(jLabel4, javax.swing.JLayeredPane.DEFAULT_LAYER);
        jFlashLogTextField.setBounds(10, 40, 210, 23);
        jLayeredPane3.add(jFlashLogTextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel1.setText("Log file read frequency (in milliseconds):");
        jLabel1.setBounds(10, 70, 320, 14);
        jLayeredPane3.add(jLabel1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jFreqTextField.setText("1000");
        jFreqTextField.setBounds(10, 90, 170, 23);
        jLayeredPane3.add(jFreqTextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jButton1.setText("Browse...");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                browseButtonClicked(evt);
            }
        });
        jButton1.setBounds(230, 40, 110, 23);
        jLayeredPane3.add(jButton1, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLayeredPane4.setBorder(javax.swing.BorderFactory.createTitledBorder("Limit"));
        jNumLinesTextField.setBounds(10, 140, 170, 23);
        jLayeredPane4.add(jNumLinesTextField, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel8.setText("Max amount of bytes to load from end of file:");
        jLabel8.setBounds(10, 120, 320, 14);
        jLayeredPane4.add(jLabel8, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jLabel11.setText("<html>This is usually required when the log file gets too big and that might cause slower performance. Setting this limit is not mandatory because Vizzy will set this automatically if runs out of memory.</html>");
        jLabel11.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jLabel11.setBounds(10, 40, 330, 70);
        jLayeredPane4.add(jLabel11, javax.swing.JLayeredPane.DEFAULT_LAYER);

        jNumLinesEnabledCheckBox.setText("Load limited amount of bytes from the end of file only");
        jNumLinesEnabledCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jNumLinesEnabledCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));
        jNumLinesEnabledCheckBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jNumLinesEnabledCheckBoxActionPerformed(evt);
            }
        });
        jNumLinesEnabledCheckBox.setBounds(10, 20, 350, 15);
        jLayeredPane4.add(jNumLinesEnabledCheckBox, javax.swing.JLayeredPane.DEFAULT_LAYER);

        org.jdesktop.layout.GroupLayout jPanelLogFileLayout = new org.jdesktop.layout.GroupLayout(jPanelLogFile);
        jPanelLogFile.setLayout(jPanelLogFileLayout);
        jPanelLogFileLayout.setHorizontalGroup(
            jPanelLogFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelLogFileLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelLogFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLayeredPane4, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE)
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, jLayeredPane3, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 373, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanelLogFileLayout.setVerticalGroup(
            jPanelLogFileLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelLogFileLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLayeredPane3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 123, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jLayeredPane4, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 194, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(12, Short.MAX_VALUE))
        );

        jPanelApplications.setPreferredSize(new java.awt.Dimension(393, 346));

        jLabel2.setText("Open source files with:");

        ASEditorButtonGroup.add(jDefaultRadioButton);
        jDefaultRadioButton.setText("Default application");

        ASEditorButtonGroup.add(jCustomEditorRadioButton);
        jCustomEditorRadioButton.setText(" ");
        jCustomEditorRadioButton.setPreferredSize(new java.awt.Dimension(25, 23));

        jCustomASEditorTextFiled.setToolTipText("<html>%file% - full path to the file<br>%line%  - line number\n</html>");
        jCustomASEditorTextFiled.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jCustomASEditorTextFiledKeyReleased(evt);
            }
        });

        jFlashDevelopIntegrLabel.setText("<html>Check out FlashDevelop Vizzy Plugin for better integration. <a href=\"http://code.google.com/p/flash-tracer/wiki/FlashDevelopPlugin\">Read more...</a></html>");
        jFlashDevelopIntegrLabel.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jFlashDevelopIntegrLabel.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jFlashDevelopIntegrLabelMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jFlashDevelopIntegrLabelMouseEntered(evt);
            }
        });

        jFlashDevelopIntegrLabel1.setText("<html>FDT, FlashBuilder and Eclipse users:<br>\"c:\\eclipse\\eclipse.exe\" --launcher.openFile \"%file%\"<br><br>Only valid for Eclipse 3.6+</html>");
        jFlashDevelopIntegrLabel1.setVerticalAlignment(javax.swing.SwingConstants.TOP);
        jFlashDevelopIntegrLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jFlashDevelopIntegrLabel1MouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                jFlashDevelopIntegrLabel1MouseEntered(evt);
            }
        });

        org.jdesktop.layout.GroupLayout jPanelApplicationsLayout = new org.jdesktop.layout.GroupLayout(jPanelApplications);
        jPanelApplications.setLayout(jPanelApplicationsLayout);
        jPanelApplicationsLayout.setHorizontalGroup(
            jPanelApplicationsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelApplicationsLayout.createSequentialGroup()
                .addContainerGap()
                .add(jPanelApplicationsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 340, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jDefaultRadioButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 320, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jPanelApplicationsLayout.createSequentialGroup()
                        .add(jCustomEditorRadioButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .add(7, 7, 7)
                        .add(jCustomASEditorTextFiled, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 300, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(jPanelApplicationsLayout.createSequentialGroup()
                        .add(20, 20, 20)
                        .add(jPanelApplicationsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jFlashDevelopIntegrLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 310, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(jFlashDevelopIntegrLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 310, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(43, Short.MAX_VALUE))
        );
        jPanelApplicationsLayout.setVerticalGroup(
            jPanelApplicationsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelApplicationsLayout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(5, 5, 5)
                .add(jDefaultRadioButton)
                .add(2, 2, 2)
                .add(jPanelApplicationsLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jCustomASEditorTextFiled, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jCustomEditorRadioButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(7, 7, 7)
                .add(jFlashDevelopIntegrLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 33, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(jFlashDevelopIntegrLabel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 106, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(110, Short.MAX_VALUE))
        );

        jVersionLabel.setText("Current version is: 1.19");

        jUpdatesCheckBox.setSelected(true);
        jUpdatesCheckBox.setText("Check for updates weekly at startup");
        jUpdatesCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        jUpdatesCheckBox.setMargin(new java.awt.Insets(0, 0, 0, 0));

        org.jdesktop.layout.GroupLayout jPanelUpdatesLayout = new org.jdesktop.layout.GroupLayout(jPanelUpdates);
        jPanelUpdates.setLayout(jPanelUpdatesLayout);
        jPanelUpdatesLayout.setHorizontalGroup(
            jPanelUpdatesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelUpdatesLayout.createSequentialGroup()
                .add(21, 21, 21)
                .add(jPanelUpdatesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jUpdatesCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 353, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jVersionLabel, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 230, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(19, Short.MAX_VALUE))
        );
        jPanelUpdatesLayout.setVerticalGroup(
            jPanelUpdatesLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanelUpdatesLayout.createSequentialGroup()
                .add(22, 22, 22)
                .add(jUpdatesCheckBox, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(18, 18, 18)
                .add(jVersionLabel)
                .addContainerGap(277, Short.MAX_VALUE))
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setTitle("Options");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        jOKButton.setText("OK");
        jOKButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jOKButtonActionPerformed(evt);
            }
        });

        jButton2.setText("Cancel");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cancelClicked(evt);
            }
        });

        jListMenu.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "General", "Log", "Trace Output", "Trace Parser", "Applications", "Updates" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        jListMenu.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
        jListMenu.setFixedCellHeight(30);
        jListMenu.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                jListMenuValueChanged(evt);
            }
        });
        jScrollPane1.setViewportView(jListMenu);

        jPanelContainer.setLayout(new javax.swing.BoxLayout(jPanelContainer, javax.swing.BoxLayout.LINE_AXIS));

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(161, 161, 161)
                        .add(jOKButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 94, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jButton2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 101, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 112, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(jPanelContainer, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 393, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 346, Short.MAX_VALUE)
                    .add(jPanelContainer, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 346, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jButton2)
                    .add(jOKButton))
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jNumLinesEnabledCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jNumLinesEnabledCheckBoxActionPerformed
        if (jNumLinesEnabledCheckBox.isSelected()) {
            long n = Long.parseLong(jNumLinesTextField.getText());
            if (n == 0) {
                jNumLinesTextField.setText("1000");
            }
        }
        jNumLinesTextField.setEnabled(jNumLinesEnabledCheckBox.isSelected());
}//GEN-LAST:event_jNumLinesEnabledCheckBoxActionPerformed

    private void jOKButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jOKButtonActionPerformed
        okOptions();
    }//GEN-LAST:event_jOKButtonActionPerformed

    private void browseButtonClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_browseButtonClicked
        File openFile = new File(jFlashLogTextField.getText());
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setSelectedFile(openFile);
        while (true) {
            int choice = fileChooser.showOpenDialog(this);
            if (choice == JFileChooser.APPROVE_OPTION) {
                openFile = fileChooser.getSelectedFile();
                jFlashLogTextField.setText(openFile.getAbsolutePath());
                break;
            } else {
                break;
            }
        }
    }//GEN-LAST:event_browseButtonClicked

    private void cancelClicked(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelClicked
        cancelOptions();
    }//GEN-LAST:event_cancelClicked

    private void jCheckBoxTraceAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxTraceAllActionPerformed
        if (jCheckBoxTraceAll.isSelected()) {
            jCheckBoxBuffer.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBoxTraceAllActionPerformed

    private void jCheckBoxVerboseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxVerboseActionPerformed
        if (jCheckBoxVerbose.isSelected()) {
            jCheckBoxBuffer.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBoxVerboseActionPerformed

    private void jCheckBoxStaticActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCheckBoxStaticActionPerformed
        if (jCheckBoxStatic.isSelected()) {
            jCheckBoxBuffer.setSelected(true);
        }
    }//GEN-LAST:event_jCheckBoxStaticActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        cancelOptions();
    }//GEN-LAST:event_formWindowClosing

    private void jFlashDevelopIntegrLabelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jFlashDevelopIntegrLabelMouseClicked
        try {
            if (Desktop.isDesktopSupported())
                Desktop.getDesktop().browse(new URI(Conf.URL_VIZZY_PLUGIN));
        } catch (Exception ex1) {
//            log.warn("websiteClicked() error", ex1);
        }
    }//GEN-LAST:event_jFlashDevelopIntegrLabelMouseClicked

    private void jFlashDevelopIntegrLabelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jFlashDevelopIntegrLabelMouseEntered
        evt.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }//GEN-LAST:event_jFlashDevelopIntegrLabelMouseEntered

    private void jCustomASEditorTextFiledKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jCustomASEditorTextFiledKeyReleased
        checkFlashDevelop();
    }//GEN-LAST:event_jCustomASEditorTextFiledKeyReleased

    private void bgColorPanelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bgColorPanelMouseEntered
        evt.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }//GEN-LAST:event_bgColorPanelMouseEntered

    private void fontColorPanelMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fontColorPanelMouseEntered
        evt.getComponent().setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }//GEN-LAST:event_fontColorPanelMouseEntered

    private void fontColorPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_fontColorPanelMouseClicked
        Color color = JColorChooser.showDialog(this, "Font Color", fontColorPanel.getBackground());
        fontColorPanel.setBackground(color);
    }//GEN-LAST:event_fontColorPanelMouseClicked

    private void bgColorPanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_bgColorPanelMouseClicked
        Color color = JColorChooser.showDialog(this, "Background Color", bgColorPanel.getBackground());
        bgColorPanel.setBackground(color);
    }//GEN-LAST:event_bgColorPanelMouseClicked

    private void jListMenuValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_jListMenuValueChanged
        int selectedIndex = jListMenu.getSelectedIndex();
        loadMenuTab(selectedIndex);
    }//GEN-LAST:event_jListMenuValueChanged

    private void jLabelVizzyTraceInfoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelVizzyTraceInfoMouseClicked
        try {
            if (Desktop.isDesktopSupported())
                Desktop.getDesktop().browse(new URI(Conf.URL_VIZZY_WIKI_TRACE));
        } catch (Exception ex1) {
            //            log.warn("websiteClicked() error", ex1);
        }
}//GEN-LAST:event_jLabelVizzyTraceInfoMouseClicked

    private void jLabelCodePopupInfoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelCodePopupInfoMouseClicked
        try {
            if (Desktop.isDesktopSupported())
                Desktop.getDesktop().browse(new URI(Conf.URL_VIZZY_WIKI_CODE_POPUP));
        } catch (Exception ex1) {
            //            log.warn("websiteClicked() error", ex1);
        }
}//GEN-LAST:event_jLabelCodePopupInfoMouseClicked

    private void jLabelClickInfoMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabelClickInfoMouseClicked
        try {
            if (Desktop.isDesktopSupported())
                Desktop.getDesktop().browse(new URI(Conf.URL_VIZZY_WIKI_CLICKABLE));
        } catch (Exception ex1) {
            //            log.warn("websiteClicked() error", ex1);
        }
}//GEN-LAST:event_jLabelClickInfoMouseClicked

    private void jFlashDevelopIntegrLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jFlashDevelopIntegrLabel1MouseClicked
        // TODO add your handling code here:
    }//GEN-LAST:event_jFlashDevelopIntegrLabel1MouseClicked

    private void jFlashDevelopIntegrLabel1MouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jFlashDevelopIntegrLabel1MouseEntered
        // TODO add your handling code here:
    }//GEN-LAST:event_jFlashDevelopIntegrLabel1MouseEntered

private void jHighlight1PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight1PanelMouseClicked
    chooseColor(jHighlight1Panel);
}//GEN-LAST:event_jHighlight1PanelMouseClicked

private void jHighlight2PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight2PanelMouseClicked
    chooseColor(jHighlight2Panel);
}//GEN-LAST:event_jHighlight2PanelMouseClicked

private void jHighlight3PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight3PanelMouseClicked
    chooseColor(jHighlight3Panel);
}//GEN-LAST:event_jHighlight3PanelMouseClicked

private void jHighlight4PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight4PanelMouseClicked
    chooseColor(jHighlight4Panel);
}//GEN-LAST:event_jHighlight4PanelMouseClicked

private void jHighlight5PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight5PanelMouseClicked
    chooseColor(jHighlight5Panel);
}//GEN-LAST:event_jHighlight5PanelMouseClicked

private void jHighlight6PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight6PanelMouseClicked
    chooseColor(jHighlight6Panel);
}//GEN-LAST:event_jHighlight6PanelMouseClicked

private void jHighlight7PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight7PanelMouseClicked
    chooseColor(jHighlight7Panel);
}//GEN-LAST:event_jHighlight7PanelMouseClicked

private void jHighlight8PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight8PanelMouseClicked
    chooseColor(jHighlight8Panel);
}//GEN-LAST:event_jHighlight8PanelMouseClicked

private void jHighlight9PanelMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jHighlight9PanelMouseClicked
    chooseColor(jHighlight9Panel);
}//GEN-LAST:event_jHighlight9PanelMouseClicked

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.ButtonGroup ASEditorButtonGroup;
    private javax.swing.JLabel bgColorLabel;
    private javax.swing.JPanel bgColorPanel;
    private javax.swing.JLabel fontColorLabel;
    private javax.swing.JPanel fontColorPanel;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JCheckBox jCheckBoxBuffer;
    private javax.swing.JCheckBox jCheckBoxStatic;
    private javax.swing.JCheckBox jCheckBoxTraceAll;
    private javax.swing.JCheckBox jCheckBoxVerbose;
    private javax.swing.JTextField jCustomASEditorTextFiled;
    private javax.swing.JRadioButton jCustomEditorRadioButton;
    private javax.swing.JRadioButton jDefaultRadioButton;
    private javax.swing.JCheckBox jEnableClickCheckBox;
    private javax.swing.JCheckBox jEnablePopupsCheckBox;
    private javax.swing.JCheckBox jEnableVizzyTraceCheckBox;
    private javax.swing.JLabel jFlashDevelopIntegrLabel;
    private javax.swing.JLabel jFlashDevelopIntegrLabel1;
    private javax.swing.JTextField jFlashLogTextField;
    private javax.swing.JComboBox jFontComboBox;
    private javax.swing.JTextField jFontSizeTextField;
    private javax.swing.JTextField jFreqTextField;
    private javax.swing.JPanel jHighlight1Panel;
    private javax.swing.JTextField jHighlight1TextField;
    private javax.swing.JPanel jHighlight2Panel;
    private javax.swing.JTextField jHighlight2TextField;
    private javax.swing.JPanel jHighlight3Panel;
    private javax.swing.JTextField jHighlight3TextField;
    private javax.swing.JPanel jHighlight4Panel;
    private javax.swing.JTextField jHighlight4TextField;
    private javax.swing.JPanel jHighlight5Panel;
    private javax.swing.JTextField jHighlight5TextField;
    private javax.swing.JPanel jHighlight6Panel;
    private javax.swing.JTextField jHighlight6TextField;
    private javax.swing.JPanel jHighlight7Panel;
    private javax.swing.JTextField jHighlight7TextField;
    private javax.swing.JPanel jHighlight8Panel;
    private javax.swing.JTextField jHighlight8TextField;
    private javax.swing.JPanel jHighlight9Panel;
    private javax.swing.JTextField jHighlight9TextField;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabelClickInfo;
    private javax.swing.JLabel jLabelCodePopupInfo;
    private javax.swing.JLabel jLabelVizzyTraceInfo;
    private javax.swing.JLayeredPane jLayeredPane1;
    private javax.swing.JLayeredPane jLayeredPane2;
    private javax.swing.JLayeredPane jLayeredPane3;
    private javax.swing.JLayeredPane jLayeredPane4;
    private javax.swing.JLayeredPane jLayeredPane5;
    private javax.swing.JList jListMenu;
    private javax.swing.JCheckBox jNumLinesEnabledCheckBox;
    private javax.swing.JTextField jNumLinesTextField;
    private javax.swing.JButton jOKButton;
    private javax.swing.JPanel jPanelApplications;
    private javax.swing.JPanel jPanelContainer;
    private javax.swing.JPanel jPanelGeneral;
    private javax.swing.JPanel jPanelLogFile;
    private javax.swing.JPanel jPanelTraceOutput;
    private javax.swing.JPanel jPanelTraceParser;
    private javax.swing.JPanel jPanelUpdates;
    private javax.swing.JCheckBox jRestoreCheckBox;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JCheckBox jUTFCheckBox;
    private javax.swing.JCheckBox jUpdatesCheckBox;
    private javax.swing.JLabel jVersionLabel;
    // End of variables declaration//GEN-END:variables

    private void okOptions() {

        HashMap<String, String> m = new HashMap<String, String>();
        m.put("TraceOutputBuffered", jCheckBoxBuffer.isSelected() ? "1" : "0");
        m.put("AS3Trace", jCheckBoxTraceAll.isSelected() ? "1" : "0");
        m.put("AS3StaticProfile", jCheckBoxStatic.isSelected() ? "1" : "0");
        m.put("AS3Verbose", jCheckBoxVerbose.isSelected() ? "1" : "0");
        

        SettingsModel s = new SettingsModel();
        s.setTraceFont((String)jFontComboBox.getSelectedItem(), jFontSizeTextField.getText(), false);
        s.setFlashLogFileName(jFlashLogTextField.getText(), false);
        s.setCheckUpdates(jUpdatesCheckBox.isSelected(), false);
        s.setMaxNumLinesEnabled(jNumLinesEnabledCheckBox.isSelected(), false);
        s.setMaxNumLines(jNumLinesTextField.getText(), false);
        s.setUTF(jUTFCheckBox.isSelected(), false);
        s.setRefreshFreq(jFreqTextField.getText(), false);
        s.setRestoreOnUpdate(jRestoreCheckBox.isSelected(), false);
        s.setCustomASEditor(jCustomASEditorTextFiled.getText(), false);
        s.setDefaultASEditor(jDefaultRadioButton.isSelected(), false);
        s.setEnableCodePopup(jEnablePopupsCheckBox.isSelected(), false);
        s.setEnableTraceClick(jEnableClickCheckBox.isSelected(), false);
        s.setBgColor(bgColorPanel.getBackground(), false);
        s.setFontColor(fontColorPanel.getBackground(), false);
        s.setEnableParsingSourceLines(jEnableVizzyTraceCheckBox.isSelected(), false);
        
        List<HighlightsColorData> list = new ArrayList<HighlightsColorData>();
        if (!"".equals(jHighlight1TextField.getText())) {
            list.add(new HighlightsColorData(1, jHighlight1TextField.getText(), 
                    jHighlight1Panel.getBackground()));
        }
        if (!"".equals(jHighlight2TextField.getText())) {
            list.add(new HighlightsColorData(2, jHighlight2TextField.getText(), 
                    jHighlight2Panel.getBackground()));
        }
        if (!"".equals(jHighlight3TextField.getText())) {
            list.add(new HighlightsColorData(3, jHighlight3TextField.getText(), 
                    jHighlight3Panel.getBackground()));
        }
        if (!"".equals(jHighlight4TextField.getText())) {
            list.add(new HighlightsColorData(4, jHighlight4TextField.getText(), 
                    jHighlight4Panel.getBackground()));
        }
        if (!"".equals(jHighlight5TextField.getText())) {
            list.add(new HighlightsColorData(5, jHighlight5TextField.getText(), 
                    jHighlight5Panel.getBackground()));
        }
        if (!"".equals(jHighlight6TextField.getText())) {
            list.add(new HighlightsColorData(6, jHighlight6TextField.getText(), 
                    jHighlight6Panel.getBackground()));
        }
        if (!"".equals(jHighlight7TextField.getText())) {
            list.add(new HighlightsColorData(7, jHighlight7TextField.getText(), 
                    jHighlight7Panel.getBackground()));
        }
        if (!"".equals(jHighlight8TextField.getText())) {
            list.add(new HighlightsColorData(8, jHighlight8TextField.getText(), 
                    jHighlight8Panel.getBackground()));
        }
        if (!"".equals(jHighlight9TextField.getText())) {
            list.add(new HighlightsColorData(9, jHighlight9TextField.getText(), 
                    jHighlight9Panel.getBackground()));
        }
        s.setHighlightColorData(list, false);

        controller.optionsOK(s, m);
    }

    private void initVars() {
        jUTFCheckBox.setSelected(settings.isUTF());
        jUpdatesCheckBox.setSelected(settings.isCheckUpdates());
        jNumLinesEnabledCheckBox.setSelected(settings.isMaxNumLinesEnabled());
        jNumLinesTextField.setText(String.valueOf(settings.getMaxNumLines()));
        jRestoreCheckBox.setSelected(settings.isRestoreOnUpdate());

        jFontComboBox.setSelectedItem(settings.getTraceFont().getName());
        jFontSizeTextField.setText(String.valueOf(settings.getTraceFont().getSize()));
        jFlashLogTextField.setText(settings.getFlashLogFileName());
        jFreqTextField.setText(String.valueOf(settings.getRefreshFreq()));
        jVersionLabel.setText("Current version is: " + Conf.VERSION);
        jNumLinesTextField.setEnabled(jNumLinesEnabledCheckBox.isSelected());
        jCheckBoxBuffer.setSelected(settings.getMmcfgKeys().get("TraceOutputBuffered", "0").equals("1"));
        jCheckBoxTraceAll.setSelected(settings.getMmcfgKeys().get("AS3Trace", "0").equals("1"));
        jCheckBoxVerbose.setSelected(settings.getMmcfgKeys().get("AS3Verbose", "0").equals("1"));
        jCheckBoxStatic.setSelected(settings.getMmcfgKeys().get("AS3StaticProfile", "0").equals("1"));
        jCustomASEditorTextFiled.setText(settings.getCustomASEditor());
        jEnableClickCheckBox.setSelected(settings.isEnableTraceClick());
        jEnablePopupsCheckBox.setSelected(settings.isEnableCodePopup());
        jEnableVizzyTraceCheckBox.setSelected(settings.isEnableParsingSourceLines());
        fontColorPanel.setBackground(settings.getFontColor());
        bgColorPanel.setBackground(settings.getBgColor());
        if (settings.isDefaultASEditor()) {
            jDefaultRadioButton.setSelected(true);
        } else {
            jCustomEditorRadioButton.setSelected(true);
        }
        List<HighlightsColorData> highlightColorData = settings.getHighlightColorData();
        for (HighlightsColorData highlights : highlightColorData) {
            try {
                JPanel panel = (JPanel) (getClass().getDeclaredField("jHighlight" 
                        + highlights.getI() + "Panel").get(this));
                JTextField tfield = (JTextField) (getClass().getDeclaredField("jHighlight" 
                        + highlights.getI() + "TextField").get(this));
                panel.setBackground(highlights.getBackground());
                tfield.setText(highlights.getText());
            } catch (Exception ex) {
                java.util.logging.Logger.getLogger(OptionsForm.class.getName()).log(Level.SEVERE, null, ex);
            } 
        }

        checkFlashDevelop();

        jListMenu.setSelectedIndex(0);
//        loadMenuTab(0);
    }

    @Override
    public void setVisible(boolean val) {
        if (val) {
            initVars();
        }
        super.setVisible(val);
    }

    @Override
    public void dispose() {
        settings = null;
        controller = null;
        super.dispose();
    }

    

    private void initPositionAndSize(Rectangle rect) {
        try {
            this.setIconImage(settings.getAppIcon());
        } catch (Exception e) {
//            log.warn("initPositionAndSize() ", e);
        }

        int x = (int)(rect.getX() + rect.getWidth() / 2 - getWidth( )/ 2);
        int y = (int)(rect.getY() + rect.getHeight() / 2 - getHeight()/ 2);
        setLocation(x, y);
    }

    private void cancelOptions() {
        controller.optionsCancelled();
    }

    private void loadMenuTab(int selectedIndex) {
        if (jPanelContainer.getComponentCount() > 0 && selectedIndex == menuIndex) {
            return;
        }
        jPanelContainer.removeAll();
        switch (selectedIndex) {
            case 0:
                jPanelContainer.add(jPanelGeneral);
                break;
            case 1:
                jPanelContainer.add(jPanelLogFile);
                break;
            case 2:
                jPanelContainer.add(jPanelTraceOutput);
                break;
            case 3:
                jPanelContainer.add(jPanelTraceParser);
                break;
            case 4:
                jPanelContainer.add(jPanelApplications);
                break;
            case 5:
                jPanelContainer.add(jPanelUpdates);
                break;
        }
        menuIndex = selectedIndex;
        jPanelContainer.validate();
        jPanelContainer.repaint();
    }

    private void chooseColor(JPanel panel) {
        Color color = JColorChooser.showDialog(this, "Highlight color", panel.getBackground());
        panel.setBackground(color);
    }

    private void afterInitComponents() {
        jHighlight1Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight2Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight3Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight4Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight5Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight6Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight7Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight8Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        jHighlight9Panel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    }

}
